

function say() {
    alert("LC:24. 两两交换链表中的节点");
}
say();


/**
 * Definition for singly-linked list.
 * function ListNode(val, next) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.next = (next===undefined ? null : next)
 * }
 */
/**
 * @param {ListNode} head
 * @return {ListNode}
 */
var swapPairs = function(head) {
    if(!head || !head.next) {
        return head
    }

    var left = head
    var right = head.next

    var last = right.next

    right.next = left
    left.next = swapPairs(last)
    return right
};
